home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / MacInterface / windows.icl < prev   
Encoding:
Modula Implementation  |  1996-02-22  |  4.9 KB  |  167 lines  |  [TEXT/3PRM]

  1. implementation module windows;
  2.  
  3. import mac_types;
  4.  
  5. InDesk :== 0;
  6. InMenuBar :== 1;
  7. InSysWindow :== 2;
  8. InContent :== 3;
  9. InDrag :== 4;
  10. InGrow :== 5;
  11. InGoAway :== 6;
  12. InZoomIn :== 7;
  13. InZoomOut :== 8;
  14.  
  15. //    Initialization and Allocation
  16.  
  17. NewWindow :: !Ptr !Rect !{#Char} !Bool !Int !WindowPtr !Bool !Int !Toolbox -> (!WindowPtr,!Toolbox);
  18. NewWindow wStorage (left,top,right,bottom) title visible procID behind goAwayFlag refCon t
  19. = code (right=W,bottom=W,left=W,top=W,wStorage=R4L,title=O8S,visible=W,
  20.           procID=W,behind=L,goAwayFlag=W,refCon=L,t=U) (window_pointer=L,z=I8Z)
  21. {
  22.     instruction 0xA913
  23. };
  24.  
  25. NewCWindow :: !Ptr !Rect !{#Char} !Bool !Int !WindowPtr !Bool !Int !Toolbox -> (!WindowPtr,!Toolbox);
  26. NewCWindow wStorage (left,top,right,bottom) title visible procID behind goAwayFlag refCon t
  27. = code (right=W,bottom=W,left=W,top=W,wStorage=R4L,title=O8S,visible=W,
  28.           procID=W,behind=L,goAwayFlag=W,refCon=L,t=U)(window_pointer=L,z=I8Z)
  29. {
  30.     instruction 0xAA45
  31. };
  32.  
  33. DisposeWindow :: !WindowPtr !Toolbox -> Toolbox;
  34. DisposeWindow theWindow t = code (theWindow=L,t=U)(z=Z){
  35.     instruction 0xA914
  36. };
  37.  
  38. //    Window Display
  39.  
  40. SetWTitle :: !WindowPtr !{#Char} !Toolbox -> Toolbox;
  41. SetWTitle theWindow title t = code (theWindow=L,title=S,t=U)(z=Z){
  42.     instruction 0xA91A
  43. };
  44.  
  45. SelectWindow :: !WindowPtr !Toolbox -> Toolbox;
  46. SelectWindow theWindow t = code (theWindow=L,t=U)(z=Z){
  47.     instruction 0xA91F            ||    _SelectWindow
  48. };
  49.  
  50. HideWindow :: !WindowPtr !Toolbox -> Toolbox;
  51. HideWindow theWindow t = code (theWindow=L,t=U)(z=Z){
  52.     instruction 0xA916            ||    _HideWindow
  53. };
  54.  
  55. ShowWindow :: !WindowPtr !Toolbox -> Toolbox;
  56. ShowWindow theWindow t = code (theWindow=L,t=U)(z=Z){
  57.     instruction 0xA915            ||    _ShowWindow
  58. };
  59.  
  60. ShowHide :: !WindowPtr !Bool !Toolbox -> Toolbox;
  61. ShowHide theWindow showFlag t = code (theWindow=L,showFlag=W,t=U)(z=Z){
  62.     instruction 0xA908            ||    _ShowHide
  63. };
  64.  
  65. SendBehind :: !WindowPtr !WindowPtr !Toolbox -> Toolbox;
  66. SendBehind theWindow behindWindow t = code (theWindow=L,behindWindow=L,t=U)(z=Z){
  67.     instruction 0xA921            ||    _SendBehind
  68. };
  69.  
  70. DrawGrowIcon :: !WindowPtr !Toolbox -> Toolbox;
  71. DrawGrowIcon theWindow t = code (theWindow=L,t=U)(z=Z){
  72.     instruction 0xA904
  73. };
  74.  
  75. FrontWindow :: !Toolbox -> (!WindowPtr,!Toolbox);
  76. FrontWindow t = code (t=R4U)(theWindow=L,z=Z){
  77.     instruction 0xA924            ||    _FrontWindow
  78. };
  79.  
  80. //    Mouse Location
  81.  
  82. FindWindow :: !Int !Int !Toolbox -> (!Int,!WindowPtr,!Toolbox);
  83. FindWindow h v t = code (h=R6W,v=W,t=O6U)(wher=W,whichWindow=l,z=Z){
  84.     instruction 0xA92C            ||    _FindWindow
  85. };
  86.  
  87. TrackGoAway :: !WindowPtr !Int !Int !Toolbox -> (!Bool,!Toolbox);
  88. TrackGoAway theWindow h v t = code (theWindow=R2L,h=W,v=W,t=U)(result=D1,z=Z){
  89.     instruction 0xA91E
  90.     instruction 0x7000            ||    moveq    #0,d0
  91.     instruction 0x101F            ||    move.b (sp)+,d0
  92.     instruction 0x4440            ||    neg.w    d0
  93.     instruction 0x48C0            ||    ext.l    d0
  94.     instruction 0x2200            ||    move.l    d0,d1
  95. };
  96.  
  97. TrackBox :: !WindowPtr !Int !Int !Int !Toolbox -> (!Bool,!Toolbox);
  98. TrackBox theWindow h v partCode t = code (theWindow=R2L,h=W,v=W,partCode=W,t=U)(result=D1,z=Z){
  99.     instruction 0xA83B
  100.     instruction 0x7000            ||    moveq    #0,d0
  101.     instruction 0x101F            ||    move.b (sp)+,d0
  102.     instruction 0x4440            ||    neg.w    d0
  103.     instruction 0x48C0            ||    ext.l    d0
  104.     instruction 0x2200            ||    move.l    d0,d1
  105. };
  106.  
  107. //    Window Movement and Sizing
  108.  
  109. MoveWindow :: !WindowPtr !Int !Int !Bool !Toolbox -> Toolbox;
  110. MoveWindow theWindow hGlobal vGlobal front t
  111. = code (theWindow=L,hGlobal=W,vGlobal=W,front=W,t=U)(z=Z){
  112.     instruction 0xA91B            ||    _MoveWindow
  113. };
  114.  
  115. DragWindow :: !WindowPtr !Int !Int !Rect !Toolbox -> Toolbox;
  116. DragWindow theWindow h v (left,top,right,bottom) t
  117. = code (right=W,bottom=W,left=W,top=W,theWindow=L,h=W,v=W,t=O8U)(z=I8Z){
  118.     instruction 0xA925
  119. };
  120.  
  121.  
  122. GrowWindow :: !WindowPtr !Int !Int !Rect !Toolbox -> (!(!Int,!Int),!Toolbox);
  123. GrowWindow theWindow h v rect tb
  124. =    ((h1,v1),tb1);
  125.     where {
  126.         (v_and_h,tb1)    =: GrowWindow1 theWindow h v rect tb;
  127.         (v1,h1)            =: v_and_h;
  128.     };
  129.  
  130. GrowWindow1 :: !WindowPtr !Int !Int !Rect !Toolbox -> (!(!Int,!Int),!Toolbox);
  131. GrowWindow1 theWindow h v (left,top,right,bottom) t
  132. = code (right=W,bottom=W,left=W,top=W,theWindow=R4L,h=W,v=W,t=O12U)(h2=W,w2=W,z=I8Z){
  133.     instruction 0xA92B
  134. };
  135.  
  136. SizeWindow :: !WindowPtr !Int !Int !Bool !Toolbox -> Toolbox;
  137. SizeWindow theWindow w h fUpdate t = code (theWindow=L,w=W,h=W,fUpdate=W,t=U)(z=Z){
  138.     instruction 0xA91D
  139. };
  140.  
  141. ZoomWindow :: !WindowPtr !Int !Bool !Toolbox -> Toolbox;
  142. ZoomWindow theWindow partCode front t = code (theWindow=L,partCode=W,front=W,t=U)(z=Z){
  143.     instruction 0xA83A
  144. };
  145.  
  146. //    Update Region Maintenance
  147.  
  148. InvalRect :: !Rect !Toolbox -> Toolbox;
  149. InvalRect (left,top,right,bottom) t = code (right=W,bottom=W,left=W,top=W,t=O0U)(z=I8Z){
  150.     instruction 0xA928
  151. };
  152.  
  153. ValidRect :: !Rect !Toolbox -> Toolbox;
  154. ValidRect (left,top,right,bottom) t = code (right=W,bottom=W,left=W,top=W,t=O0U)(z=I8Z){
  155.     instruction 0xA92A
  156. };
  157.  
  158. BeginUpdate :: !WindowPtr !Toolbox -> Toolbox;
  159. BeginUpdate theWindow t = code (theWindow=L,t=U)(z=Z){
  160.     instruction 0xA922
  161. };
  162.  
  163. EndUpdate :: !WindowPtr !Toolbox -> Toolbox;
  164. EndUpdate theWindow t = code (theWindow=L,t=U)(z=Z){
  165.     instruction 0xA923
  166. };
  167.